package com.tyl.xtk.beans.query;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * create by tyl at 2025/8/27
 */
@Data
@Schema(description = "分页参数")
@NoArgsConstructor
public class PageQuery {

    @Schema(description = "分页页码")
    private long pageNum = 1;

    @Schema(description = "分页大小")
    private long pageSize = 10;

    public PageQuery(long pageNum, long pageSize) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
    }

    public <T> IPage<T> toPage() {
        return new Page<>(pageNum, pageSize);
    }
}
